package io.github.lee.core.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Transaction
import androidx.room.Update

@Dao
interface BaseRoomDao<T> {

    @Transaction
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertReplace(data: T)

    @Insert(onConflict = OnConflictStrategy.ABORT)
    fun insertAbort(data: T)

    @Insert(onConflict = OnConflictStrategy.IGNORE)
    fun insertIgnore(data: T): Long


    @Update
    fun update(data: T): Int

    @Delete
    fun delete(data: T): Int

}